/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package labb6;

import java.io.IOException;
import java.net.URL;
import javax.swing.JEditorPane;
import javax.swing.JOptionPane;
//import javax.swing.JScrollPane;
import javax.swing.event.HyperlinkEvent;

/**
 *
 * @author Lisa
 */
public class Webreader extends JEditorPane{
    String currentURL;
    
    public Webreader(){
        setEditable(false);
    }
    
        void goTo(String url){
        try{
            currentURL = url;
            setPage(url);
            //addHyperlinkListner(arg);
        }
        catch (IOException e){
            JOptionPane.showMessageDialog(this, "Fel vid läsning av: "+url+"\n"+e);
        }
    }
        String getURL(){
            return currentURL;
        }

   //public void addHyperlinkListner(HyperlinkEvent event){
        //if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED){
            //try{
                //this.setPage(event.getURL());
            //}
            //catch(IOException e){
                
        //}
            
}
    
    

